<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>校园生活圈管理平台</title>
	<%@ include file="../header_inc.jsp" %>
	<style type="text/css">
	
	*{margin:0; padding:0;}
	ul{list-style-type:none; zoom:1;}
	ul li{float:center; margin:10px; _display:inline; border:0px solid #CCC;}
	ul li a img{width:48px; height:48px; border:0;display:block;margin:0px auto; vertical-align: middle;text-align:center;}
	ul li a.wenzi{line-height:20px; color:#666; display:block; text-align:center;}
	ul li a:hover{color:#F00;}
	.tabsMenu .split{line-height:1px;color:black;display:block;}
	</style>
	<script type="text/javascript">
		//动态生成操作菜单
		$(document).ready(function() {
			$.ajax({
				url:'${baseUrl}/manage/menu',
				type:'post',
				async:false,
				dataType:'json',
				success:function(data){
					if(data.success==0)
					{
					    var pid=0;
					    var content="";
					    var title="";
					    var imgCls="";
						$.each(data.rows,function(i,item){
						    var content="";
						    if(item.children != null)
						    {
						        $.each(item.children,function(i,subItem){
	                                content = content + "<li><a href=\"javascript:addTab(\'"+subItem.name+"\',\'"+subItem.url+"\')\"><img src=\"${baseUrl}/tpl/${tpl}/icon/"+subItem.img+"\" width=\"32\" /></a><a class=\"wenzi\" href=\"javascript:addTab(\'"+subItem.name+"\',\'"+subItem.url+"\')\">"+subItem.name+"</a></li>";
						        });
						    }
						    $('#nav_menu').accordion('add', {
	                            title: "&nbsp;&nbsp;"+item.name,
	                            content: '<div style="padding:0px;overflow:hidden"><ul id="ulSubMenu'+item.id+'">'+content+'</ul></div>',
	                            selected: false,
	                            iconCls: item.img
	                        }); 
						});
					}
					else
					{
						showErrMsg(data);
					}
				}
			});
		});
		
		function logout(flag)
		{
		    var msg;
		    if(flag)
		    {
		        msg = "你是否要退出系统？";
		    }
		    else
		    {
		        msg = "你是否要重新登录系统？";
		    }
		    $.messager.confirm("退出",msg,function(yesOrNo){
		        if(yesOrNo)
		        {
		            $.ajax("${baseUrl}/manage/logout",{
		                error:function(){
		                    $.messager.alert("提示","资源访问错误！${ctx}");
		                    
		                    window.parent.location.href="${ctx}/index";
		                },
		                success:function(data){
		                    var json = $.parseJSON(data);
		                    if(json.success==0)
		                    {
		                        if(flag)
		                        {
		                            window.opener = null;
		                            window.open('${baseUrl}','_self');
		                            window.close();
		                        }
		                        else
		                        {
		                            window.parent.location.href="${baseUrl}/";
		                        }
		                    }
		                    else
		                    {
		                        showErrMsg(json);
		                    }
		                }
		            });
		        }
		    });
		}
	
		function addTab(title,url){
           	if ($('#centerTabs').tabs('exists', title))
           	{
               	var currtab = $('#centerTabs').tabs('getSelected');
               	var tab = $("#centerTabs").tabs("getTab", title);
               	if (currtab == tab) {
                   	var url=$(currtab.panel('options').content).attr('src');
                   	refreshTab(tab, url);
               	}
               	else {
                   	var tab = $("#centerTabs").tabs("select", title);
                   	var currtab = $('#centerTabs').tabs('getSelected');
                   	var url = $(currtab.panel('options').content).attr('src');
                   	refreshTab(tab, url);
               	}
           	}
           	else {
			     var content = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>';
               	$('#centerTabs').tabs('add',
                   {
                       title: title,
                       content: content,
                       closable: true
                   });
           	}
       	}
			
			
		function refreshTab(obj,url)
		{
		     var refresh_tab = obj;
		     if (refresh_tab && refresh_tab.find('iframe').length > 0)
		        {
		           var _refresh_ifram = refresh_tab.find('iframe')[0];
		           _refresh_ifram.contentWindow.location.href = url;
		        } 
		}
			
		$(function () {
		    //绑定tabs的右键菜单
		    $("#centerTabs").tabs({
		        onContextMenu : function (e, title) {
		            e.preventDefault();
		            $('#tabsMenu').menu('show', {
		                left : e.pageX,
		                top : e.pageY
		            }).data("tabTitle", title);
		        }
		    });

		    //实例化menu的onClick事件
		    $("#tabsMenu").menu({
		        onClick : function (item) {
		        	if(item.name == 'refresh')
		        	{
		        		var refresh_tab = $('#centerTabs').tabs('getSelected');
		        		if (refresh_tab && refresh_tab.find('iframe').length > 0)
				        {
				           var _refresh_ifram = refresh_tab.find('iframe')[0];
				           _refresh_ifram.contentWindow.location.reload();
				        } 
		        	}
		        	else
		        	{
			            CloseTab(this, item.name);
		        	}
		        }
		    });

		    //几个关闭事件的实现
		    function CloseTab(menu, type) {
		        var curTabTitle = $(menu).data("tabTitle");
		        var tabs = $("#centerTabs");
		        
		        if (type === "close") {
		            tabs.tabs("close", curTabTitle);
		            return;
		        }
		        
		        var allTabs = tabs.tabs("tabs");
		        var closeTabsTitle = [];
		        
		        $.each(allTabs, function () {
		            var opt = $(this).panel("options");
		            if (opt.closable && opt.title != curTabTitle && type === "Other") {
		                closeTabsTitle.push(opt.title);
		            } else if (opt.closable && type === "All") {
		                closeTabsTitle.push(opt.title);
		            }
		        });
		        for (var i = 0; i < closeTabsTitle.length; i++) {
		            tabs.tabs("close", closeTabsTitle[i]);
		        }
		    }
		});
	
	function changePwd()
	{
        var params = {
                winId:'win_change_pwd',
                title:'修改密码',
                width:310,
                height:200,
                showUrl:'${baseUrl}/manage/changePwd',
                refresh_fun:function(){
                    top.Ext.Msg.alert("提示","密码修改成功，下次登录请使用新密码！");
                }
                
        };
        open_fun(params);
	    
	}
	
	
	function show(){
		var date = new Date(); //日期对象
		var now = "";
		now = date.getFullYear()+"/"; //读英文就行了
		now = now + (date.getMonth()+1)+"/"; //取月的时候取的是当前月-1如果想取当前月+1就可以了
		now = now + date.getDate()+" &nbsp;&nbsp;";
		now = now + date.getHours()+":";
		now = now + date.getMinutes()+":";
		now = now + date.getSeconds()+"&nbsp";
		document.getElementById("nowDiv").innerHTML = now; //div的html是now这个字符串;
		setTimeout("show()",1000); //设置过1000毫秒就是1秒，调用show方法
	}
	function gotoBaidu(){
		//window.location.href="http://www.baidu.com/"; 
		window.open("http://www.baidu.com/");
	}
	function playMusic(){
		
		
		show();
		/* var audio = document.createElement('audio');
		audio.src = '${ctx}/BackgroundMusic/9.wav'//这里放音乐的地址
		audio.autoplay = 'autoplay';
		document.getElementById("playMusic").innerHTML = audio; */
		/* document.body.appendChild(audio); */
	}

	


	</script>
</head>
<body class="easyui-layout" onload="show()">
	<!-- 上部   start -->
	<div data-options="region:'north',border:false" style="height:100px;padding:0px">
		<div  style="margin-left: 0px;margin-right: 0px;float: left;width:100%;">
			<img src="${ctx}/images/icon_background.png" height="100px" width="100%"/>
		</div>
<%-- 		<div id="playMusic" align="center" style="position: absolute; right: 0px; top: 0px;">
				<audio src="${ctx}/BackgroundMusic/ScarboroughFair.mp3" controls="controls" autoplay="autoplay"  loop=true>
					Your browser does not support the audio tag.
				</audio>
		</div> --%>
		<div style="position: absolute; right: 0px; bottom: 0px;">
			<a href="javascript:void(0);" class="easyui-menubutton" menu="#layout_north_kzmbMenu" iconCls="icon-help">控制面板</a><a href="javascript:void(0);" class="easyui-menubutton" menu="#layout_north_zxMenu" iconCls="icon-back">注销</a>
			<div id="nowDiv" align="center" ></div>
		</div>
		<div id="layout_north_kzmbMenu" style="width: 100px; display: none;">
			<div onclick="userInfo();">个人信息</div>
			<div onclick="changePwd();">密码修改</div>
		</div>
		<div id="layout_north_zxMenu" style="width: 100px; display: none;">
			<div onclick="logout();">重新登录</div>
			<div onclick="logout(true);">退出系统</div>
			
		</div>
	</div>
	<!-- 上部   end -->
	<!-- 导航  start -->
	
	<div data-options="region:'west',split:false,title:'&nbsp;&nbsp;功能菜单',iconCls:'icon-tip'" style="width:10%;padding:0px;overflow:hidden;">
		<div id="nav_menu" class="easyui-accordion" fit="false" border="false" style="">
			<c:if test="${!empty user.sysDepartment.depIcon}">
				<img src="${user.sysDepartment.depIcon}" width="100%" height="120px"/>
			</c:if>
			<c:if test="${empty user.sysDepartment.depIcon}">
				<img src="${ctx}/images/icon_school.png" width="100%" height="120px"/>
			</c:if>
			
			<div title="用户管理" data-options="iconCls:'icon-search'" style="padding:10px;">
				<ul id="ulSubMenu1">
					<li>
						<a href="javascript:addTab('用户信息','/manage/sysUser/index')"><img src="${ctx}/images/icon/u101.png" width="32" /></a>
						<a class="wenzi" href="javascript:addTab('用户信息','/manage/sysUser/index')">用户信息</a>
					</li>
					
				</ul>
			</div>
			<div title="功能管理" data-options="iconCls:'icon-search'" style="padding:10px;">
				<ul id="ulSubMenu1">
					<li>
						<a href="javascript:addTab('失物招领','/manage/sysLostAndFound/index')"><img src="${ctx}/images/icon/u105.png" width="32" /></a>
						<a class="wenzi" href="javascript:addTab('失物招领','/manage/sysLostAndFound/index')">失物招领</a>
					</li>
					<li>
						<a href="javascript:addTab('公告牌','/manage/sysNotice/index')"><img src="${ctx}/images/icon/u107.png" width="32" /></a>
						<a class="wenzi" href="javascript:addTab('表白墙','/manage/sysNotice/index')">公告牌</a>
					</li>
				</ul>
			</div>
			<%-- <c:if test="${user.userName == '超级管理员'}"> --%>
				<div id="customer" title="部门管理" data-options="iconCls:'icon-search'" style="padding:10px;">
				<ul id="ulSubMenu1">
					<li>
						<a href="javascript:addTab('客户信息','/manage/sysCustomer/index')"><img src="${ctx}/images/icon/u108.png" width="32" /></a>
						<a class="wenzi" href="javascript:addTab('客户信息','/manage/sysCustomer/index')">客户信息</a>
					</li>
					<li>
						<a href="javascript:addTab('部门信息','/manage/sysDepartment/index')"><img src="${ctx}/images/icon/u109.png" width="32" /></a>
						<a class="wenzi" href="javascript:addTab('部门信息','/manage/sysDepartment/index')">部门信息</a>
					</li>
					
				</ul>
				</div>
			<%-- </c:if> --%>
			
		</div>
	</div>
	<!-- 导航   end -->
	<!-- 中间   start -->	
	<div data-options="region:'center',title:'当前用户【${user.userName}】'">
		<div id="centerTabs" class="easyui-tabs" fit="true">  
		 	<div title="失物招领" style="width: 80%;height: 100%;">
		 		<iframe scrolling="no" frameborder="0" src="/manage/sysLostAndFound/index" style="width:100%;height:100%;"></iframe>    
    		</div>  
		</div>
	</div>
	<div id="tabsMenu" class="easyui-menu" style="width:120px;">
	    <div name="refresh">刷新</div>  
	  	<div style="line-height:1px;color:black;display:block;" name=""></div>  
	    <div name="close">关闭</div>  
	    <div name="Other">关闭其他</div>  
	    <div name="All">关闭所有</div>
	 </div>  
	<!-- 中间   end -->	
	<!-- 右边   start -->	
	<!-- <div data-options="region:'west',split:false,title:'&nbsp;&nbsp;功能菜单',iconCls:'icon-tip'" style="width:160px;padding:0px;overflow:hidden;">
		<div id="nav_menu" class="easyui-accordion" fit="false" border="false" style="">
		
		</div>
	</div> -->
<%-- 	<div data-options="region:'east' ,split:false,title:'&nbsp;&nbsp;广告位',iconCls:'icon-tip'" style="width:10%;padding:0px;overflow:hidden;" > 
		<div id="centerTabs" class="easyui-accordion" fit="true" border="false">
		 	<div style="width: 10%;height: 100%;">  
				<img onclick="gotoBaidu()" src="${ctx}/images/ad_blue.png" width="100%" height="100%"/>
			</div> 
		</div>
	</div>  --%>
	<!-- 右边   end -->
	<!-- 底部   start -->
	<div data-options="region:'south',border:false" style="height:25px;padding:1px;">
		<div  align="center">版权所有&copy;WZL科技，推荐分辨率1024*768+，使用谷歌内核浏览器可以获得更快的页面响应速度</div>
	</div>
	<!-- 底部   end -->
</body>
</html>




<a href> </a>




